<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>按钮</button>
    <script>
        // 事件源
        const btn = document.querySelector("button")
        // 绑定事件(事件类型, 事件处理程序)
        btn.addEventListener("click", function(){
            alert("点击了一下按钮")
        })
    </script>
</body>
</html>